<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib prefix="t" uri="http://myfaces.apache.org/tomahawk"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Data Mining Tool</title>
</head>
<body bgcolor="#99CCFF">

	<f:view>

		<center>
			<h:form>
				<h:commandButton type="submit" value="Home" action="userMainMenu" />
				<h:commandButton type="submit" value="Logout"
					action="logout?faces-redirect=true" />
			</h:form>
		</center>
		<br />
		<hr />
		<br />
		<h:form>
			<center>
				<h:outputText value="Populate all Tables from the Database:" />
				&nbsp; &nbsp;
				<h:commandButton id="populateTable"
					action="#{tableListBean.populateTables}" value="POPULATE" />
				<br> <br>

				<h:panelGrid>
					<h:selectOneMenu value="#{tableListBean.tableName}">
						<h:outputText value="Select a Table for Statistical Analysis :" />&nbsp; &nbsp; 
					<f:selectItems value="#{tableListBean.tableNames}" />
					</h:selectOneMenu>
				</h:panelGrid>

				<br> <br>

				<h:outputText value="Populate all Columns from the Table:" />
				&nbsp; &nbsp;
				<h:commandButton id="populateColumn"
					action="#{tableListBean.populateColumns}" value="POPULATE" />
				<br> <br>

				<h:panelGrid>
					<h:selectManyListbox value="#{tableListBean.columnName}"
						size="#{tableListBean.noOfColumns}">
						<h:outputText value="Select Column(s) for Statistical Analysis :" />&nbsp; &nbsp; 
					<f:selectItems value="#{tableListBean.columnNames}" />
					</h:selectManyListbox>
				</h:panelGrid>

				<br> <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
				<h:commandButton id="export"
					action="#{dataMiningTool.computeStatisticalAnalysis}"
					value="CALCULATE" />
				<br> <br>

				<c:if test="${dataMiningTool.statsBean != null}">

					<h:dataTable value="#{dataMiningTool.statsBean}" var="statsBean"
						border="1">
						<h:column>
							<f:facet name="header">
								<h:outputText value="VARIABLE NAME" />
							</f:facet>
							<h:outputText value="#{statsBean.variableName}" />
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="MINIMUM" />
							</f:facet>
							<h:outputText value="#{statsBean.minimum}" />
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="MAXIMUM" />
							</f:facet>
							<h:outputText value="#{statsBean.maximum}" />
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="MEAN" />
							</f:facet>
							<h:outputText value="#{statsBean.mean}" />
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="MEDIAN" />
							</f:facet>
							<h:outputText value="#{statsBean.median}" />
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value=" SD " />
							</f:facet>
							<h:outputText value="#{statsBean.standardDeviation}" />
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="  Q1  " />
							</f:facet>
							<h:outputText value="#{statsBean.firstQuartile}" />
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value=" Q3 " />
							</f:facet>
							<h:outputText value="#{statsBean.secondQuartile}" />
						</h:column>
					</h:dataTable>
				</c:if>
			</center>
		</h:form>
	</f:view>
</body>
</html>